<template>
	<view class="locus-page">
		<title text="选择车辆"></title>
		<view class="start-end">
			<view class="time"  @click="gotoSelectVehicle">
				<view class="time-l">选择车辆</view>
				<input class="time-ipt" type="text" placeholder="请选择车辆" :disabled="true" :value="carInfo.vehicleNum" />
				<image :src="icon" mode="aspectFill"></image>
			</view>
		
		</view>
	
		<btnBottom text="查 询" :marginTop="48" @onBtnClick="gotoDetail"></btnBottom>
	</view>
</template>

<script>
	import title from '../components/title.vue';
	import { mapState } from 'vuex';
	import btnBottom from '../components/btnBottom.vue';
	import utils from "@/utils/utils.js"
	export default{
		components: {
			title,
			btnBottom
		},
		data() {
			return {
				
			}
		},
		onLoad(options) {
			this.isClear = options.isClear || 0
		},
		computed: {
			...mapState({
				carInfo: state => state.bike.carInfo
			})
		},
		onReady() {
	
		},
		beforeDestroy() {	
			if(this.isClear == 0) {
				this.$store.commit('SET_CAR_INFO', {})
			}	
		},
		methods: {
			
			gotoSelectVehicle() {
				uni.navigateTo({
					url: '/pages/vehicle/vehicleSelect/index'
				})
			},
			
			gotoDetail(){			
				if (this.checkParams()){			
					var obj = {
						vehicleId: this.carInfo.id,
						vehicleNum: this.carInfo.vehicleNum,
					}
					console.log("gotoTrackDetail", utils.KeyValueToUrl(obj))	
					uni.navigateTo({
						url: '/pages/vehicle/video/realTimeDetail?' + utils.KeyValueToUrl(obj)
					})
					
				}
			},
			
			checkParams(){
				if (!(this.carInfo&&this.carInfo.id)){
					uni.$snowy.modal.msgError("请选择车辆")
					return false
				}
		
				return true	
			}
		}
	}
</script>

<style lang="scss" scoped>
	.locus-page{
		padding: 0 24rpx;
		min-height: 100vh;
		background: #F9F9FA;
	}
	
	.start-end{
		padding: 0 24rpx;
		background: #FFFFFF;
		border: 1px solid #E5E5E6;
		border-radius: 8rpx;
	}
	.time{
		height: 99rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 28rpx;
	}
	.time image{
		width: 50rpx;
		height: 50rpx;
	}
	.time-l{
		height: 30rpx;
		padding-right: 36rpx;
		border-right: 1px solid #E4E4E4;
		margin-right: 36rpx;
	}
	.time-r, .time-ipt{
		flex: 1;
		color: #666666;
		min-width: 350rpx;
	}
	
	.nav-box{
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		.nav-item{
			width: 166rpx;
			height: 68rpx;
			background: #FFFFFF;
			border: 1px solid #E5E5E6;
			border-radius: 8rpx;
			color: #333333;
			font-size: 28rpx;
			text-align: center;
			line-height: 68rpx;
			margin-bottom: 10rpx;
		}
		.nav-act{
			color: #fff;
			background: #3791E9;
		}
	}
	
</style>
